<?php

include("algoritmo.php");

echo "<br><br>";
$L = simp_subs($_POST['str']);
//echo derivada($L[4], $L);
//print_r($D);

$N = tolatex($L);

$de = derivada($L[count($L)-1], $L);
$M = simp_subs($de);
$M = tolatex($M);

echo '<img src="http://latex.codecogs.com/gif.latex?\frac{\mathrm{d} }{\mathrm{d} x}('.substituir_L_latex($N[count($N)-1], $N).') = '.substituir_L_latex($M[count($M)-1], $M).'"/>';

?>